

#Defines topics of interests to log from nagios and their regexps

expressions = {
      'check_cpu' : {
        'eventtype' : 'CPU',
        'properties' : ['state', 'user' , 'system', 'idle'], # ordenado !
        'regexp' : r"CPU usage \(%user %system %idle\) (OK|WARNING|CRITICAL) - (\d+) (\d+) \*?(\d+)\*?"
        },
      'check_disk' : {
        'eventtype' : 'Disk',
        'properties' : ['state', 'free_space' , 'usage'], # ordenado !
        'regexp' : r"Disk space (OK|WARNING|CRITICAL) - (\d+) kB free \( \*?(\d+)\*? % used\)"
        },
      'check_load' : { 
        'eventtype' : 'Load',
        'properties' : ['state', '1min', '5min', '15min'], # ordenado !
        'regexp' : r"Load average (OK|WARNING|CRITICAL) - (\d+) (\d+) \*?(\d+)\*?"
        },
     'check_memory' : {
        'eventtype' : 'Memory',
        'properties' : ['state', 'free', 'used'], # ordenado !
        'regexp' : r"Memory RAM (OK|WARNING|CRITICAL) - \*?(\d+)\*? kB free \( (\d+) kB used\)"
        },
      'check_swap' : {
      'eventtype' : 'Swap',
      'properties' : ['state', 'total', 'used'], # ordenado !
      'regexp' : r"Swap (OK|WARNING|CRITICAL) - (\d+) kB total size \( \*?(\d+)\*? kB available space\)"
      },
      'check_mysql_query' : {
      'eventtype' : 'Query',
      'properties' : ['state', 'entries'], # ordenado !
      'regexp' : r"QUERY (OK|WARNING|CRITICAL): 'select count\(\*\) from nagios_hosts' returned (\d+\.\d*)"
      },
      'check_smtp' : {
      'eventtype' : 'SMTP',
      'properties' : ['state', 'responsetime'], # ordenado !
      'regexp' : r"SMTP (OK|WARNING|CRITICAL) - (\d+\.\d*) sec. response time"
      },
      'host' : {
      'eventtype' : 'host',
      'properties' : ['state', 'loss' , 'rta'], # ordenado !
      'regexp' : r"FPING (OK|WARNING|CRITICAL) - \S+ \(loss=(\d+)%(?:(?:, rta=(\d+\.\d*) ms\))|())"
      }
}
